package tests;

import java.util.List;
import system.BlogSystem;

/**
 * Excecução facade class for testing the easyaccept
 */
public class UserStoryFacade {

	private BlogSystem system = BlogSystem.getInstance();	
		
	public void createProfile(String login, String senha, String nome_exibicao,
			String email, String sexo, String dataNasc, String endereco, String interesses,
			String quem_sou_eu, String filmes, String musicas, String livros) throws Exception {
		
		system.createUser(login, senha, nome_exibicao, email, sexo, dataNasc, endereco, interesses, quem_sou_eu, filmes, musicas, livros);	
	}
	
	public void cleanPersistence() {
		system.cleanPersistence();
	}
	
	public String getProfileInformation (String login, String atributo) throws Exception{
		return system.getInformationProfile(login, atributo);
	}

	public void saveData(){
		
	}
	
	public void loadData(){
		// TODO do I need to do something here? o.o'	
	}
		
	public String logon(String login, String senha) throws Exception{
		return system.login(login, senha);
	}

	public boolean isUserLogged(String login) throws Exception{
		return system.isUserLogged(login);
	}
	
	public String getProfileInformationBySessionId(String idSession, String atributo) throws Exception{
		return system.getInformationProfileBySessionId(idSession, atributo);
	}
	
	public void logoff(String idSession) throws Exception{
		system.logout(idSession);
	}
	
	public void changeProfileInformation(String idSession, String atributo, String valor) throws Exception{
		system.changeProfileInformation(idSession, atributo, valor);
	}
		
	public String createBlog(String sessionID, String title, String description) throws Exception{
		return system.createBlog(sessionID, title, description);
	}
	
	public String getBlogInformation(String blogID, String atributo) throws Exception{
		return system.getInformationBlog(blogID, atributo);
	}
	
	public void changeBlogInformation(String sessionID, String blogID, String attribute, String value) throws Exception{
		system.changeBlogInformation(sessionID, blogID, attribute, value);
	}
	
	public String todaysDate() {
		return system.todaysDate();
	}

	public String createPost(String sessionId, String blogId, String title,
			String text) throws Exception {
		return system.createPost(sessionId, blogId, title, text);
	}

	public String attachSound(String sessionId, String postId,
			String description, String data) throws Exception {
		return system.attachSound(sessionId, postId, description, data);
	}

	public String attachMovie(String sessionId, String postId,
			String description, String data) throws Exception {
		return system.attachMovie(sessionId, postId, description, data);
	}

	public String attachPicture(String sessionId, String postId,
			String description, String data) throws Exception {
		return system.attachPicture(sessionId, postId, description, data);
	}

	public String getPostInformation(String postId, String atributo)
			throws Exception {
		return system.getPostInformation(postId, atributo);
	}

	public String getNumberOfSounds(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfSoundsOfPost(postId));
	}

	public String getNumberOfMovies(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfMoviesOfPost(postId));

	}

	public String getNumberOfPictures(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfPicturesOfPost(postId));
	}


	public String getSound(String postId, long index) throws Exception {
		return system.getSound(postId, index);
	}

	public String getSoundDescription(String audioId) throws Exception {
		return system.getMediaDescription(audioId);
	}

	public String getSoundData(String audioId) throws Exception {
		return system.getMediaData(audioId);
	}

	public String getMovie(String postId, long index) throws Exception {
		return system.getMovie(postId, index);
	}

	public String getMovieDescription(String videoId) throws Exception {
		return system.getMediaDescription(videoId);
	}

	public String getMovieData(String videoId) throws Exception {
		return system.getMediaData(videoId);
	}
	
	public String getPictureDescription(String imageId) throws Exception{
		return system.getMediaDescription(imageId); 
	}

	public String getPictureData(String imageId) throws Exception{
		return system.getMediaData(imageId); 
	}

	public String getPicture(String postId, long index) throws Exception {
		return system.getPicture(postId, index);
	}
	public String getNumberOfBlogsByLogin(String login) throws Exception{
		return String.valueOf(system.getNumberOfBlogsByLogin(login));
	}
	
	
	public String getNumberOfBlogsBySessionId(String sessionId) throws Exception{
		return String.valueOf(system.getNumberOfBlogsBySessionId(sessionId));
	}

	public String getBlogBySessionId (String sessionId, int index) throws Exception{
		return system.getBlogBySessionId(sessionId, index);
	}
	
	public String getBlogByLogin(String login, int index) throws Exception{
		return system.getBlogByLogin(login, index);
	}
	
	public String getNumberOfPosts(String blogId) throws Exception{
		return String.valueOf(system.getNumberOfPosts(blogId));
	}

	public String getPost(String blogId,int index) throws Exception{
		return system.getPost(blogId, index);
	}

	//#o metodo changePostInformation sera responsavel por alterar apenas a parte textual de um post. 
	public void changePostInformation(String sessionId, String postId, String atributo, String valor) throws Exception{
		system.changePostInformation(sessionId, postId, atributo, valor);
	}
	
	public void deleteMovie(String sessionId, String movieId) throws Exception{
		system.deleteMovie(sessionId, movieId);
	}
	
	public void deleteSound(String sessionId, String soundId) throws Exception{
		system.deleteSound(sessionId, soundId);
	}

	public void deletePicture(String sessionId, String pictureId) throws Exception{
		system.deletePicture(sessionId, pictureId);
	}
	
	public String addComment(String sessionId, String postId, String texto) throws Exception{

		return system.addComment(sessionId, postId, texto);
	}
	
	public String getNumberOfComments(String postId) throws Exception{
		return String.valueOf(system.getNumberOfComments(postId));
	}

	public String getComment(String postId, int index) throws Exception{
		return system.getComment(postId, index);
	}

	public String getCommentText(String commentId) throws Exception{
		return system.getCommentText(commentId);
	}

	public String getCommentAuthor(String commentId) throws Exception{
		return system.getCommentAuthor(commentId);
	}

	public void deletePost(String sessionId, String postId) throws Exception{
		system.deletePost(sessionId, postId);
	}
		
	public void deleteBlog(String sessionId, String blogId) throws Exception{
		system.deleteBlog(sessionId, blogId);
	}
	
	public void deleteProfile(String sessionId) throws Exception{
		system.deleteProfile(sessionId);
	}
	
	public List<String> findProfileByName(String match) throws Exception{
		return system.findProfileByName(match);
	}
	
	public String findProfileByInterests(String match) throws Exception{
		return system.findProfileByInterests(match).toString().replace(" ", "");
	}
	
	public String findProfileByGender(String match)throws Exception{
		return system.findProfileByGender(match).toString().replace(" ", "");
	}
	
	public String findBlogByName(String match) throws Exception{
		return system.findBlogByName(match).toString().replace(" ", "");
	}
	
	public String getNumberOfComments(String login, String blogId) throws Exception{
		return system.getNumberOfComments(login, blogId);
	}
	
	public String getNumberOfAnnouncements(String sessionId) throws Exception{
		return String.valueOf(system.getNumberOfAnnouncements(sessionId));
	}
	
	public void addPostAnnouncements(String sessionId, String blogId) throws Exception{
		system.addPostAnnouncements(sessionId, blogId);
	}
	
	public String getAnnouncement(String sessionId, int index) throws Exception{
		return system.getAnnouncement(sessionId, index);
	}
	
	public String getPostJustCreated(String announcementId){
		return system.getPostJustCreated(announcementId);
	}
	
	public void deleteAnnouncement(String sessionId, String announcementId) throws Exception{
		system.deleteAnnouncement(sessionId, announcementId);
	}

	public String createSubBlog(String sessionId, String blogId, String title,
			String description) throws Exception {
		return system.createSubBlog(sessionId, blogId, title, description);

	}
	
	public String getNumberOfSubBlogs(String blogId) throws Exception{
		return String.valueOf(system.getNumberOfSubBlogs(blogId));
	}
	
	public String getNumberOfAllSubBlogs(String blogId) throws Exception{
		return String.valueOf(system.getNumberOfAllSubBlogs(blogId));
	}
	
	public String getSubBlog(String blogId, int index) throws Exception{
		return system.getSubBlog(blogId, index);
	}

	public String getNumberOfAllPosts(String blogId) throws Exception{
		return String.valueOf(system.getNumberOfAllPosts(blogId));
	}
	
	public String addSubComment(String sessionId, String commentId, String texto) throws Exception{

		return system.addSubComment(sessionId, commentId, texto);
	}
	
	public String getSubComment(String commentId, int index) throws Exception{
		return system.getSubComment(commentId, index);
	}
	
	public String getNumberOfSubComments(String commentId) throws Exception{
		return String.valueOf(system.getNumberOfSubComments(commentId));
	}
	
	public String getNumberOfAllSubComments(String commentId) throws Exception{
		return String.valueOf(system.getNumberOfAllSubComments(commentId));
	}
}